﻿@inherits _BaseView

<MudRTLProvider RightToLeft="@SharedLayoutSettings.IsRTL">
    <MudDialog>
        <DialogContent>
            <MudGrid>
                <MudItem md="12">
                    <MudTextField @bind-Value="FilterViewModel.Message" Variant="Variant.Outlined"
                                  Adornment="Adornment.Start" AdornmentIcon="@Icons.Material.Filled.FilterDrama" Clearable
                                  For="@(() => FilterViewModel.Message)"
                                  Label="Message" />
                </MudItem>
                <MudItem md="6">
                    <MudDatePicker Label="Log Date From" Clearable
                                   Color="Color.Success" Rounded Elevation="12"
                                   For="@(() => FilterViewModel.LogDateFrom)" @bind-Date="FilterViewModel.LogDateFrom"
                                   Culture="@GetCalendarCulture(CultureInfo.DefaultThreadCurrentUICulture.Name)"
                                   Adornment="Adornment.Start" AdornmentIcon="@Icons.Material.Filled.EditCalendar"
                                   PickerVariant="PickerVariant.Dialog"
                                   Variant="Variant.Outlined" TitleDateFormat="dddd, dd MMMM" />
                </MudItem>
                <MudItem md="6">
                    <MudDatePicker Label="Log Date To" Clearable
                                   Color="Color.Success" Rounded Elevation="12"
                                   For="@(() => FilterViewModel.LogDateTo)" @bind-Date="FilterViewModel.LogDateTo"
                                   Culture="@GetCalendarCulture(CultureInfo.DefaultThreadCurrentUICulture.Name)"
                                   Adornment="Adornment.Start" AdornmentIcon="@Icons.Material.Filled.EditCalendar"
                                   PickerVariant="PickerVariant.Dialog"
                                   Variant="Variant.Outlined" TitleDateFormat="dddd, dd MMMM" />
                </MudItem>
                <MudItem md="12">

                </MudItem>
                <MudItem md="12">

                </MudItem>
                <MudItem md="12">

                </MudItem>
                <MudItem md="12">

                </MudItem>
            </MudGrid>
            <MudPaper Class="pa-3 my-2 ActionColor" Elevation="3" Outlined Square>
                <MudStack Spacing="1" Row>
                    <MudButton OnClick="Search" Variant="Variant.Filled" Color="Color.Tertiary" StartIcon="@Icons.Material.Filled.ManageSearch" IconColor="Color.Surface">@DashboardResource.StringSearch</MudButton>
                    <MudButton OnClick="Close" Variant="Variant.Filled" Color="Color.Primary" StartIcon="@Icons.Material.Filled.FreeCancellation" IconColor="Color.Surface">@DashboardResource.StringCancel</MudButton>
                </MudStack>
            </MudPaper>
        </DialogContent>
    </MudDialog>
</MudRTLProvider>

@code {

    [CascadingParameter]
    public MudDialogInstance MudDialog { get; set; }

    private void Close() => MudDialog.Close();

    // *****************************************************

    private async Task Search()
    {
        await Task.Delay(100);

        MudDialog.Close(DialogResult.Ok(FilterViewModel));
    }

    [Parameter]
    public FilterLogViewModel FilterViewModel { get; set; } = new();

}
